package com.sheng.project.test.sort;

/**
 * 选择排序：固定一个位置的数和后面的数进行比较
 *
 * @author liusheng
 * @date 2022/08/19
 */
public class SelectSort {

    public static void select(int[] ints) {
        int length = ints.length;
        for (int i = 0; i < length; i++) {
            for (int j = i + 1; j < length; j++) {
                if (ints[i] > ints[j]) {
                    int t = ints[i];
                    ints[i] = ints[j];
                    ints[j] = t;
                }
            }
        }
    }
}
